UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '21/kLjeoAIU6P8raTBiKN8p0mJd6JsHJtu6SZ3wZqc4='
WHERE
key_id = '02ddb48b892cd7848a5fbada6101b9fcd87899fdfbfbed5ca86cba09f2eae96e'
AND (
token = '21/kLjeoAIU6P8raTBiKN8p0mJd6JsHJtu6SZ3wZqc4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)