UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eO0waeyDY0w884tp0FJ9Y49nmKM/qx9Qu/gr1Kf9HwQ=' 
WHERE 
  key_id = '3b29b955ce628131edb82f4037dd3bfd5b839afae6677a3dc0dff31bfbe1162e' 
  AND (
    token = 'eO0waeyDY0w884tp0FJ9Y49nmKM/qx9Qu/gr1Kf9HwQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022