UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pq9wiL16j6LAj2yNtNYCY8u+f6Tte+kM+E5TVdGaBEM='
WHERE
key_id = '520b6e88110db845bd51879fe905485afbf284f1973a5519c77f1b9cf415d994'
AND (
token = 'pq9wiL16j6LAj2yNtNYCY8u+f6Tte+kM+E5TVdGaBEM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)