UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wE2h+p1bWHBWft+rqmk/9Ltqp2ZTxnKHMuKiZ1BooHI=' 
WHERE 
  key_id = '0d1162675328a1ef302064e2fe6bd5b4d7c7374787bb0c7edf0f30c12982fa5a' 
  AND (
    token = 'wE2h+p1bWHBWft+rqmk/9Ltqp2ZTxnKHMuKiZ1BooHI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022