UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TOhxCLrEQl4O5fJ/ChvYpvjU2e+oor5PIo8fOlAHrOc=' 
WHERE 
  key_id = '4a373b4deeb9d577ffdd4e85079120d0dac2141382722fff1cae5e4c20951ed7' 
  AND (
    token = 'TOhxCLrEQl4O5fJ/ChvYpvjU2e+oor5PIo8fOlAHrOc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058