UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'E+szBD27Z+IvUuddrxWfAXHzxagp2Zx7JvpJIwJPW6Y='
WHERE
key_id = 'bd1af789d76fe38519ff72cf7b48d99c8cf7d90ef1717df7b6b7fd661a6c348c'
AND (
token = 'E+szBD27Z+IvUuddrxWfAXHzxagp2Zx7JvpJIwJPW6Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)