UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NPLgymvgYQJ69ld+8ilkeeFfzWXe7TC12Ewjgvb3lG8='
WHERE
key_id = '31622a943c380e014677921c4fa75585e716fe211b7cea1b5da4ce1e6d1a976a'
AND (
token = 'NPLgymvgYQJ69ld+8ilkeeFfzWXe7TC12Ewjgvb3lG8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)