UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MaGwek+RtI0gY4/x+5FSjHLv4vscu4x8m7B2WtoTj8c=' 
WHERE 
  key_id = '8eb8988864e0f094507f4feb4ab8e64abff765999d781e17dfda9e9a129f611d' 
  AND (
    token = 'MaGwek+RtI0gY4/x+5FSjHLv4vscu4x8m7B2WtoTj8c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019