UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EJhi+xUidoQL2O1uUNVd6F8yFdYnnfCqGumpsbGH/c4=' 
WHERE 
  key_id = '6c5806390db686f1ea31875391da4ccccda131191780e834bbc5347c79d4116a' 
  AND (
    token = 'EJhi+xUidoQL2O1uUNVd6F8yFdYnnfCqGumpsbGH/c4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035