UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zs+8KFQL3Eu9tF0F56Xguo6Ov6SvSjcutXLV2Tar4uw='
WHERE
key_id = '51612251558dd95d3a9957b0610e26938e2357fd3efb9430d42095c47feb8313'
AND (
token = 'zs+8KFQL3Eu9tF0F56Xguo6Ov6SvSjcutXLV2Tar4uw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)