UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3wx5hmqwtHU2qO2gq5swZHQ1AFG94EXlj+yB6jTH460=' 
WHERE 
  key_id = 'd6c388cd7fbbedba7f7e51b219435d000d1b67c33bc6328c76401610f17b80af' 
  AND (
    token = '3wx5hmqwtHU2qO2gq5swZHQ1AFG94EXlj+yB6jTH460=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043