UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N7kNBi4724rjxyUeiEwlg/w60oYC62zwY/5OZSVI1Us='
WHERE
key_id = '945f051f98f549155e785d92267819f5a78737d27f39547adffff0bae429156e'
AND (
token = 'N7kNBi4724rjxyUeiEwlg/w60oYC62zwY/5OZSVI1Us='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)