UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2DZqphFyypbtTRN5G3jL3KTXYr0h+ps4q4xRORvuSRk=' 
WHERE 
  key_id = 'aa795a75b308f166f66312273cbd435199eb79bcd2ead0c249f3bce0f63a1602' 
  AND (
    token = '2DZqphFyypbtTRN5G3jL3KTXYr0h+ps4q4xRORvuSRk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036