UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ttyp6f83X0SUleig5ghYT6KZKSlmaAr9Iqe1tkE0IHA=' 
WHERE 
  key_id = '357776a535560559cd0fcb25d57c078280ac55e719e05f8d37072e9342d0e9e8' 
  AND (
    token = 'Ttyp6f83X0SUleig5ghYT6KZKSlmaAr9Iqe1tkE0IHA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027