UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k+0BiI4q6H6kTykjbY75LyuT50SxRCttHin+qC5B1CU=' 
WHERE 
  key_id = 'd2c3ed6f56d903c9e5d805b240d8e78d2725ce5f3c413e8d29c6c52ee2936e73' 
  AND (
    token = 'k+0BiI4q6H6kTykjbY75LyuT50SxRCttHin+qC5B1CU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032