UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G86xH3eObsqQhyQGGwqxpPlBsyckSAnzmwME7DcEeI8=' 
WHERE 
  key_id = '56c2bfd62833f3fec43f4936b1288f2d7fc827dedde2840c8d7147d619029030' 
  AND (
    token = 'G86xH3eObsqQhyQGGwqxpPlBsyckSAnzmwME7DcEeI8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033