UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Jv4M8dwyouc6qoAR+ftnaUBmIDjFblsACH3ZOa/Q9wk=' 
WHERE 
  key_id = '41d1e7f2b320627ec00c067bac8185e8fda1d67ac12c0c6b41af2635dc534acc' 
  AND (
    token = 'Jv4M8dwyouc6qoAR+ftnaUBmIDjFblsACH3ZOa/Q9wk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036