UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zIP9C6Ha5xIL4AJhmdM+OaoJId3XOomlriYdkrJ8Pbw='
WHERE
key_id = 'e275831d1d75145bcfe4a67b5fe9522ee5d0572604fbf6674760f2d1479af0c0'
AND (
token = 'zIP9C6Ha5xIL4AJhmdM+OaoJId3XOomlriYdkrJ8Pbw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)