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