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

Query time 0.00034