UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pAmKc0Ib2eyKm1SomDfyB7XNWd4Irxw6ztMi32Y33Po='
WHERE
key_id = '84c7416a5cb03086ddd6b943d344b47d973dd7aefb1142d1af95a405f17b413b'
AND (
token = 'pAmKc0Ib2eyKm1SomDfyB7XNWd4Irxw6ztMi32Y33Po='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)