UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B/lh4vJjE9ihxlpJVh7VoaC2Bv5pN2jbYlLHmrpwDlQ='
WHERE
key_id = '511e399fbe8f500a2e0443e90c6591fc58e825088c675f6cfceaaa883efbf8eb'
AND (
token = 'B/lh4vJjE9ihxlpJVh7VoaC2Bv5pN2jbYlLHmrpwDlQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)