UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Qcs16TU3LA8QGgRRSXLU2FEYiouQvs9l6+1LPvnR9fs='
WHERE
key_id = 'd4f7e941729e6cd17aa077b90c39a4423492929fa42e1e1e937ba6970525312b'
AND (
token = 'Qcs16TU3LA8QGgRRSXLU2FEYiouQvs9l6+1LPvnR9fs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)