UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5iyJXBABONe+t4LrdAQdpxjMd6A8INq2d15UzH2braU='
WHERE
key_id = '45a0c6ae50c74c7ea8518137d71b74f0e40ad3a443ba4bbb6214acd036579939'
AND (
token = '5iyJXBABONe+t4LrdAQdpxjMd6A8INq2d15UzH2braU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)