UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ydOp2gElTn2jld7eZ3F8VG/jPrDW0yh2mQLISfd+/Gk=' 
WHERE 
  key_id = 'bd6b965b5e8d4f42956b8edb99974864550b14475c4ba4112ca6e0aef1da9aa5' 
  AND (
    token = 'ydOp2gElTn2jld7eZ3F8VG/jPrDW0yh2mQLISfd+/Gk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059