UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tumsGJAjpur+NVRXOvvJdCBFetC+HriCLCdJCtY6OGs=' 
WHERE 
  key_id = 'dfce6ac7c64c5f9ed65c6606f74f78c6278e5f8cf34bcc420b2da754b5401146' 
  AND (
    token = 'tumsGJAjpur+NVRXOvvJdCBFetC+HriCLCdJCtY6OGs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046