UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MxHL9HHxuUbGLRvSj7nY0YQfDmfc7bK3balvHi+Rrw4='
WHERE
key_id = 'df677693590ebd3251f118d26341d44339533b1f36f58d008280f807c02f9e82'
AND (
token = 'MxHL9HHxuUbGLRvSj7nY0YQfDmfc7bK3balvHi+Rrw4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)