UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bfSBNhfaJu9hAJt3OzuAN7ovL0pgiSns6z3slwwaRQ0=' 
WHERE 
  key_id = '24adde67fc2d202a2c0e71692a8011c9d39d7933c5da51775ed2554d304740ff' 
  AND (
    token = 'bfSBNhfaJu9hAJt3OzuAN7ovL0pgiSns6z3slwwaRQ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029