UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jC49kx1Y1X9Hc0MyttQ6eF60aVzSyL5CNnAJqgal5ss=' 
WHERE 
  key_id = 'e1480646a8bb00cc18c85537eb1155ba95690659592f1c823a2e32b8fbd494ff' 
  AND (
    token = 'jC49kx1Y1X9Hc0MyttQ6eF60aVzSyL5CNnAJqgal5ss=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023