UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VG/Fzy3l5tZysW45yPqstPCFHnKWqQ4/KX/R7O80Pao=' 
WHERE 
  key_id = 'bc29db412e1becd47cccba5e52eb66237452d93fabfacded8d217ee4657161d1' 
  AND (
    token = 'VG/Fzy3l5tZysW45yPqstPCFHnKWqQ4/KX/R7O80Pao=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044