UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'psB1zE+1656jKEsSbmUwL3vxsFoidkN0tirS0PBhSKM='
WHERE
key_id = 'cc8ddafc74fe6a769458ddc6a703a8d7393807889b21115895e2dfc5943e7753'
AND (
token = 'psB1zE+1656jKEsSbmUwL3vxsFoidkN0tirS0PBhSKM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)