UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Zowf4CwN8tiYy4g1mNUDMXH+RPns8wA6nnXVA6zNoi0='
WHERE
key_id = 'ecf5931d17c6fb09336cd251422d9831b25a346f3d9f4c2853c48160149664ce'
AND (
token = 'Zowf4CwN8tiYy4g1mNUDMXH+RPns8wA6nnXVA6zNoi0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)