UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iJBF1ojc4WNvaQKJsguFVxJKqz3cFLHA3VHtI/7/W04='
WHERE
key_id = 'cd049a1277c078da72eea040032b41417ad9d6f6eae291510b5b42cea4df68fc'
AND (
token = 'iJBF1ojc4WNvaQKJsguFVxJKqz3cFLHA3VHtI/7/W04='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)