UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BDCgnXmgFjey8hNIf2mpoXZ9/fBg+34Qz0ZedhmgeEQ='
WHERE
key_id = 'adb11986fad624e68376313840150403b8694faa84a417a4ab159cc98d616aef'
AND (
token = 'BDCgnXmgFjey8hNIf2mpoXZ9/fBg+34Qz0ZedhmgeEQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)