UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'I1KrfT89YR17o5YYSfCBmlSpRm7UfVQF3o9wpCyfyhk='
WHERE
key_id = 'bcdef2134b61dc2c7a412709f031411d1cfcd8dfb769c473389c30790a0c75f3'
AND (
token = 'I1KrfT89YR17o5YYSfCBmlSpRm7UfVQF3o9wpCyfyhk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)