UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Jlszbntqr3lZ9tN4WRdukAiIkebhvVEojY89xTDxsm8=' 
WHERE 
  key_id = 'a1a186b9253497529028e6d9b3c4eaa83f8c8aecfeea577f879ada6982855544' 
  AND (
    token = 'Jlszbntqr3lZ9tN4WRdukAiIkebhvVEojY89xTDxsm8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027