UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EjgDoEvm9UX6TkHp6n9c6sqUiRARz16IkL5pecHz9Yg=' 
WHERE 
  key_id = '304c4f9ade7d0930c0025cdd0b8c727f693f3c21e67620e00c143c64e1cfc1d3' 
  AND (
    token = 'EjgDoEvm9UX6TkHp6n9c6sqUiRARz16IkL5pecHz9Yg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017