UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'miyGlMno7XZ+dcz/2NcHFTM713QfGqHX15PHWk1W7Dg='
WHERE
key_id = 'c66d9634510446d26af8a45a917f59e0b38310852303bff65e32182e55fa8464'
AND (
token = 'miyGlMno7XZ+dcz/2NcHFTM713QfGqHX15PHWk1W7Dg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)