UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1KTMkkRgVTMVyQZHGCcs1jxlLo55R5LJQ/E3sYxEj2Y='
WHERE
key_id = 'a5a3c333808a8e8ebf52a72261ab9cf9aaa698939122b152937d3685b5330b7e'
AND (
token = '1KTMkkRgVTMVyQZHGCcs1jxlLo55R5LJQ/E3sYxEj2Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)