UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0PWhBtx7/1tdLMVc7rSZPIzKxy+8RWHnyW5piRiDFNg='
WHERE
key_id = '13e58e42e8b69d7ca600ffd20d3667c20fb5fee592779e085a199ce456915deb'
AND (
token = '0PWhBtx7/1tdLMVc7rSZPIzKxy+8RWHnyW5piRiDFNg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)