UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yBGfKRDzmA1v4W2EvDVS30/1Awbn2VlWwdm84Y+1gHc='
WHERE
key_id = 'c9bfe7973c1f17eddcda366f2af819113bc62a51984b306330656205c6c6e6de'
AND (
token = 'yBGfKRDzmA1v4W2EvDVS30/1Awbn2VlWwdm84Y+1gHc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)