UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0ggR587zlWTUr86IUN6tHQgsd8Sg5h1a9WDBGPFZz2Q='
WHERE
key_id = '4871fe3073170108bd9819906193fc79cacdf0aa05d9001f8968616fc9401748'
AND (
token = '0ggR587zlWTUr86IUN6tHQgsd8Sg5h1a9WDBGPFZz2Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)