UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yy0pXFU/An0gwWBa/7hiD5jxXDIsj+8atgGG+QpKHU8='
WHERE
key_id = '4d45802580059cb2fe14ec9a877af80d0cb242a269eb4dfe9fde15e6e08b6885'
AND (
token = 'yy0pXFU/An0gwWBa/7hiD5jxXDIsj+8atgGG+QpKHU8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)