UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QDrNrzgvZUgo2MfPAf45t6pmRhQmVSQGaz2voP0r+2U=' 
WHERE 
  key_id = '44cc7958cbde021ab31c06e39adfcbd02d418456526c196521a1806f19edd38d' 
  AND (
    token = 'QDrNrzgvZUgo2MfPAf45t6pmRhQmVSQGaz2voP0r+2U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038