UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PIuDQn7lOowNpIZSqBmWAGPdxevpzzao2Z+fX95QpSU='
WHERE
key_id = '5221011c3ae6b7c4ee61b9a080137c6e56a9cd711e0632c4157dfe13153f5326'
AND (
token = 'PIuDQn7lOowNpIZSqBmWAGPdxevpzzao2Z+fX95QpSU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)