UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8cj9Wa6fDfG9xE+/FjZUjAyx+8iIkjL79QOl8Z+aA5Y=' 
WHERE 
  key_id = 'f0d657d2cbed2eaa12c22434ad9af922d326c67d283f7bb2949c47e2dd10080e' 
  AND (
    token = '8cj9Wa6fDfG9xE+/FjZUjAyx+8iIkjL79QOl8Z+aA5Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059