UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qMHhDbQ5sZjrt5T6UQFy2koi+b7pZdmejzwkXESrtHI='
WHERE
key_id = 'ca99d1482808db971b80fbe8797f65b139bfdd9fb85cc18ca783fc74881dc796'
AND (
token = 'qMHhDbQ5sZjrt5T6UQFy2koi+b7pZdmejzwkXESrtHI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)