UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LJiHHvdMXCgmjbsVxRGlbib/KQ4oiv+5s/XbVHmyvbA=' 
WHERE 
  key_id = 'a38774cd1a8ae86f7195b145400c8f14f42871318a1b26d5b77a1108881497c3' 
  AND (
    token = 'LJiHHvdMXCgmjbsVxRGlbib/KQ4oiv+5s/XbVHmyvbA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039