UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GQF5heJYsj11tAkChijx+2t5tm0Wzpo6OLwts/O5UDc=' 
WHERE 
  key_id = 'b25e4d5058a9918daff760468606a218d1636277426df39d162b318445e5d9f5' 
  AND (
    token = 'GQF5heJYsj11tAkChijx+2t5tm0Wzpo6OLwts/O5UDc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037