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