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

Query time 0.00039