UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W8WtenB6+3sf8iZdj8fGw1p8hNRCf1BW3EfMewFD7Nw=' 
WHERE 
  key_id = '78333bfe2317ef87c746edba8396d597af44ecf663909739987f435307320f85' 
  AND (
    token = 'W8WtenB6+3sf8iZdj8fGw1p8hNRCf1BW3EfMewFD7Nw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036