UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k4V7G2UGxuwlgbUFUNyNHz2Z98oBSi8NkKT8lM2+vO8=' 
WHERE 
  key_id = '9b8db0e257bd3c619ba773d15d9aa4d555ab04ccf77ac2819a431976d252e2a6' 
  AND (
    token = 'k4V7G2UGxuwlgbUFUNyNHz2Z98oBSi8NkKT8lM2+vO8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033