UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8ufe4gJtErLgL2lER8GnKajx1Lfge4jMeaP6ttQW64g=' 
WHERE 
  key_id = '3979c81c4a9bcae2273754f7deb0eaf66037fd469f04c226e88d252769630537' 
  AND (
    token = '8ufe4gJtErLgL2lER8GnKajx1Lfge4jMeaP6ttQW64g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021