UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aGvBSQ+cZgRdIXiTf9KjMSaoStP2FpP7JKjgPB22T/8=' 
WHERE 
  key_id = 'd163c5ffb1434512717f0540b4837e4c894b42c09d14a7e314257e8ccb77553c' 
  AND (
    token = 'aGvBSQ+cZgRdIXiTf9KjMSaoStP2FpP7JKjgPB22T/8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048