UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'asBkukJnl+rbqk6Tu9Sty1vfHky2dVd+47UL2ZNFXEw=' 
WHERE 
  key_id = '5ad263921c845301d807a6334595f5002f21aadc88193da8b5b8a98d45c0890c' 
  AND (
    token = 'asBkukJnl+rbqk6Tu9Sty1vfHky2dVd+47UL2ZNFXEw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018