UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xq2kJjqqyJCh9lu/M+lEM7c/wB6zsDv42UkEE1joFiA=' 
WHERE 
  key_id = '5d6495b924cf1e52b2ac9da999f9833177f5eeef3017e33da3630cf38a956581' 
  AND (
    token = 'xq2kJjqqyJCh9lu/M+lEM7c/wB6zsDv42UkEE1joFiA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062