UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'e6ejNIMlMr5axD61GxAfXuGqc/ZPfwcDLk38uOST5s8='
WHERE
key_id = 'a8c50ff9e46ce3b0d75e2f9800823f79d0f854f199312ea33aa3039a673a8425'
AND (
token = 'e6ejNIMlMr5axD61GxAfXuGqc/ZPfwcDLk38uOST5s8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)