UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Mdn0ct6lq4uiEpSLNEqhSXTxH0JMLkm5jTydUatVsXk=' 
WHERE 
  key_id = 'df1973ddd650e0a12daa77c5ec18418efc9038362b3d1823e47f433acaa95602' 
  AND (
    token = 'Mdn0ct6lq4uiEpSLNEqhSXTxH0JMLkm5jTydUatVsXk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045