UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gJql/cRkkIajRM19808kCBeCXuTdmvmGOdfWBh8zAxQ='
WHERE
key_id = '2d369f015d69b98c47b260a994a1c82f84ec143762eeaac3f704b1df571182cf'
AND (
token = 'gJql/cRkkIajRM19808kCBeCXuTdmvmGOdfWBh8zAxQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)