UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PdwYJUHZ2p4qPyELLR0FjnGMhhATPS+lRWb91wmWao0='
WHERE
key_id = 'b30716b5f306b9b5e8f334416a7918a235738e20e492ada569575739be807d2e'
AND (
token = 'PdwYJUHZ2p4qPyELLR0FjnGMhhATPS+lRWb91wmWao0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)