UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SbzKIO6KWfvbTshoWYUQVo1eV6520AK7wT9DeVg6XtQ=' 
WHERE 
  key_id = '3c663bcd69302480e2f3f1ceab57a808053a88bb0af3eaf5f9e69caceefee9c0' 
  AND (
    token = 'SbzKIO6KWfvbTshoWYUQVo1eV6520AK7wT9DeVg6XtQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025